deploy: Use fdatasync() for new kernel/initramfs by default
authorColin Walters <walters@verbum.org>
Wed, 2 May 2018 15:59:21 +0000 (11:59 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 2 May 2018 19:37:52 +0000 (19:37 +0000)
While we do a `syncfs()` plus `FIFREEZE/THAW` for `/boot`, that
only comes during deployment finalization.

The code here today generally assumes that if the file exists
it's been fully written.  So let's do a `fdatasync()` before
we do the `rename()`.

This just came out of looking through the code while working
on deployment staging.  In that scenario there's a much larger
window between when we copy the kernel/initramfs and when we
sync `/boot`.

Closes: #1571
Approved by: jlebon

src/libostree/ostree-sysroot-deploy.c

index b21be0e96fad2c40e252d2ce3ebc10a287be5f53..7830e830b795c3a56c9a945c8748724f07a70cf9 100644 (file)
@@ -128,7 +128,7 @@ install_into_boot (OstreeSePolicy *sepolicy,
                                                     error))
             return FALSE;
           return glnx_file_copy_at (src_dfd, src_subpath, NULL, dest_dfd, dest_subpath,
-                                    GLNX_FILE_COPY_NOXATTRS,
+                                    GLNX_FILE_COPY_NOXATTRS | GLNX_FILE_COPY_DATASYNC,
                                     cancellable, error);
         }
       else